home *** CD-ROM | disk | FTP | other *** search
/ PC Electronic Plus / PC Electronics Plus (Most Significant Bits)(1995).ISO / pcreson / logsim.txt < prev    next >
Text File  |  1987-01-02  |  59KB  |  1,651 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.             
  9.  
  10.             
  11.  
  12.             
  13.  
  14.             
  15.  
  16.             
  17.  
  18.             
  19.  
  20.                                     L O G S I M
  21.  
  22.                                           
  23.  
  24.                              a Logic Simulation program
  25.                                     Version 2.1
  26.  
  27.                                           
  28.  
  29.                                           
  30.  
  31.                                           
  32.  
  33.                                           
  34.  
  35.                       Copyright (C), 1986 by Scott Romanowski
  36.                                 All rights reserved
  37.                          Commercial Duplication Prohibited
  38.                                           
  39.                                           
  40.                                           
  41.                                           
  42.                                           
  43.                                           
  44.                                           
  45.                                  November 20, 1986
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                                                         I
  71.  
  72.  
  73.                                       Contents
  74.             
  75.             1. Introduction........................................... 1
  76.               1.1 Duplication and Use Policy.......................... 1
  77.             2. Using LOGSIM........................................... 2
  78.               2.1 Equation Syntax and Node Numbers.................... 3
  79.               2.2 Tri-State and Open Collector Outputs................ 3
  80.               2.3 Initial Conditions.................................. 4
  81.             3. Describing the Circuit................................. 4
  82.               3.1 Gates............................................... 4
  83.                 3.1.1 AND Gate........................................ 5
  84.                 3.1.2 BUFFER Gate..................................... 5
  85.                 3.1.3 DELAY Gate...................................... 5
  86.                 3.1.4 DELAYH Gate..................................... 6
  87.                 3.1.5 DELAYL Gate..................................... 6
  88.                 3.1.6 NAND Gate....................................... 6
  89.                 3.1.7 NOR Gate........................................ 6
  90.                 3.1.8 NOT Gate........................................ 7
  91.                 3.1.9 OR Gate......................................... 7
  92.                 3.1.10 XNOR Gate...................................... 7
  93.                 3.1.11 XOR Gate....................................... 7
  94.               3.2 Chips............................................... 8
  95.                 3.2.1 D Chip Descriptor............................... 8
  96.                 3.2.2 JK Chip Descriptor.............................. 8
  97.                 3.2.3 7476 Chip Descriptor............................ 9
  98.                 3.2.4 74112 Chip Descriptor........................... 9
  99.                 3.2.5 74123 Chip Descriptor........................... 9
  100.                 3.2.6 74126 Chip Descriptor.......................... 10
  101.                 3.2.7 74192 Chip Descriptor.......................... 10
  102.                 3.2.8 74193 Chip Descriptor.......................... 10
  103.                 3.2.9 74253 Chip Descriptor.......................... 11
  104.               3.3 Clocks............................................. 11
  105.               3.4 Data Sources....................................... 11
  106.             4. Simulating the Circuit................................ 12
  107.               4.1 Simulation Time.................................... 12
  108.               4.2 Rise Time Calculations............................. 12
  109.               4.3 Gate Delays........................................ 13
  110.               4.4 Initial Conditions................................. 13
  111.               4.5 Output Modes....................................... 14
  112.                 4.5.1 Display........................................ 14
  113.                 4.5.2 File........................................... 14
  114.                 4.5.3 Print.......................................... 15
  115.                 4.5.4 Fprint......................................... 16
  116.               4.6 Time Units per Screen.............................. 17
  117.               4.7 Monitoring nodes................................... 17
  118.               4.8 Fanout Lists....................................... 17
  119.             5. Chip Descriptions..................................... 17
  120.               5.1 Making New Chips................................... 18
  121.                 5.1.1 Pins, Delay, Mode and Output Pins.............. 18
  122.                 5.1.2 Chip Modes..................................... 19
  123.                 5.1.3 Output Equations............................... 19
  124.               5.2 Sample Chip Descriptions........................... 20
  125.               5.3 Simulating ROMS.................................... 20
  126.               5.4 Simulating RAMS.................................... 21
  127.  
  128.  
  129.  
  130.                                        LOGSIM
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                                                         II
  137.  
  138.  
  139.               5.5 Simulating PALs and PLAs........................... 21
  140.             
  141.  
  142.  
  143.  
  144.  
  145.  
  146.  
  147.  
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.                                        LOGSIM
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                                                         1
  203.  
  204.  
  205.  
  206.             1. Introduction
  207.  
  208.  
  209.                  LOGSIM is  a digital  logic simulation  program.  It is
  210.             very general and infinitely expandable.  Users create a file
  211.             describing their circuit and select options to configure the
  212.             simulation.
  213.  
  214.                  All times  in the circuit are measured in "time units".
  215.             A time  unit is  any amount of time, determined by the user.
  216.             If the  user wants to use 10 nanoseconds per time unit, then
  217.             a 100 nanosecond delay would be 10 time units.
  218.  
  219.                  Logic values  are simply  represented as  high and  low
  220.             states, the  actual voltage levels are immaterial to LOGSIM.
  221.             Tri-state and open collector outputs are handled specially--
  222.             see the section describing them below.
  223.  
  224.                  LOGSIM requires  DOS 2.1  or higher and one disk drive.
  225.             To use  the PRINT  option (graphics  timing diagram  on  the
  226.             printer), the  graphics screen  dump program included in DOS
  227.             is  required.     Using   PC-DOS,  this  program  is  called
  228.             GRAPHICS.COM, using  MS-DOS, this  program  is  one  of  the
  229.             PSCxxxx.COM programs.  See your DOS manual for more informa-
  230.             tion.
  231.  
  232.                  This manual  is written for people who have some famil-
  233.             iarity with  DOS (somewhere  between neophyte  and  wizard).
  234.             You must  be able to edit files to use LOGSIM.  Knowledge of
  235.             the print  screen command,  file  and  path  names,  default
  236.             drive, default  directory, and batch files will help, but is
  237.             not required.   It  goes without  saying, but  you must know
  238.             about digital  logic before  understanding what this program
  239.             does.
  240.  
  241.               1.1 Duplication and Use Policy
  242.  
  243.  
  244.                  LOGSIM is  distributed as  shareware.   You can make as
  245.             many copies  as you  desire, and give away as many copies as
  246.             desired.   Users may  not charge  others for  copies of this
  247.             program without  the express  written permission  of the au-
  248.             thor.  If you must charge for the disk(s) when you give away
  249.             a copy,  you may  charge no more than $1.00 (one dollar) per
  250.             disk.
  251.  
  252.                  If you  distribute this  program, you must include this
  253.             policy with  the copy.   You  may not include any portion of
  254.             this program,  modified or not, in any other program without
  255.             the written permission of the author.
  256.  
  257.                  If you are pleased with this program, the author humbly
  258.             requests that  you send  $20 to  the author.   Shareware  is
  259.  
  260.  
  261.  
  262.                                        LOGSIM
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                                                         2
  269.  
  270.  
  271.             based on  the belief  that people will gladly pay for a good
  272.             product, yet  should not  be required to pay for a bad prod-
  273.             uct.   Shareware lets  people experiment  with programs, and
  274.             form their own opinion of the product.
  275.  
  276.                  If you choose not to support the author, there is noth-
  277.             ing to  stop you from continuing to use LOGSIM.  If you sup-
  278.             port the  author, good  for you!   You  have made the author
  279.             very happy.
  280.  
  281.                  The author can be reached at:
  282.                       Scott Romanowski
  283.                       5 Sherburn Place
  284.                       Wilmington, MA 01887
  285.  
  286.                  In addition, improvements to LOGSIM are planned.  These
  287.             improvements will  speed simulation,  allow larger circuits,
  288.             allow easy  implementation of  RAM memories,  and  add  more
  289.             standard chips.   If this program generates a good response,
  290.             the author will surely distribute the updates.  On the other
  291.             hand, a discouraged author probably won't.
  292.  
  293.             2. Using LOGSIM
  294.  
  295.  
  296.                  In order to have LOGSIM simulate your circuit, you must
  297.             create a  circuit descriptor  file describing  your circuit.
  298.             To use  LOGSIM, at  the DOS  prompt, type  "LOGSIM".  LOGSIM
  299.             will reply with "Circuit Descriptor file", to which you type
  300.             the name  of the  circuit descriptor  file.  Optionally, you
  301.             can include  the name  of the circuit descriptor file on the
  302.             command line, by typing "LOGSIM filename" (where filename is
  303.             the name of the circuit descriptor file).
  304.  
  305.                  A circuit  descriptor file  consists of  two parts: the
  306.             circuit itself,  and a  list of options for LOGSIM.  The two
  307.             parts are  separated by an END statement--simply a line with
  308.             the word END.
  309.  
  310.                  A sample circuit descriptor is shown below:
  311.  
  312.                            JK H 14 1 H 2 13 3
  313.                            JK H 15 1 H 2 14 4
  314.                            JK H 5 1 H 2 15 16
  315.                            AND 5 3 4
  316.                            CLOCK 1 0000111
  317.                            DATA 2 01
  318.                            END
  319.                            TIME 60
  320.                            MONITOR 13 14 15
  321.                            PRINT
  322.  
  323.                  The first  6 lines describe the circuit (in this case a
  324.             simple 0-1-2-4  counter), the 7th line is the end statement,
  325.  
  326.  
  327.  
  328.                                        LOGSIM
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                                                         3
  335.  
  336.  
  337.             and lines  8 through  10 are the options.  LOGSIM recognizes
  338.             both upper  and lower  case letters,  and both can be freely
  339.             mixed in your input.
  340.  
  341.                  When LOGSIM  is reading  your circuit  description,  it
  342.             displays "Reading element ..." messages to inform you of its
  343.             progress, and  to aid  in debugging  if there is an error in
  344.             your circuit  description.  After LOGSIM is finished reading
  345.             your circuit  descriptor, LOGSIM  prints "Circuit descriptor
  346.             read in" and starts simulating your circuit.  There may be a
  347.             few second  pause while  LOGSIM determines the initial state
  348.             of the circuit.
  349.  
  350.               2.1 Equation Syntax and Node Numbers
  351.  
  352.  
  353.                  Logical expressions  are only  used in  coding chip de-
  354.             scriptors.  In that case and in this manual, LOGSIM uses the
  355.             following symbols when representing logic equations:
  356.  
  357.                  ~ NOT     & AND     + OR      * XOR
  358.  
  359.                  These are  listed in order of precedence, except OR and
  360.             XOR are the same precedence.  Expressions are evaluated from
  361.             left to  right.   Parentheses (parentheses only, no brackets
  362.             [] or braces {} ) can be used to group expressions and over-
  363.             ride precedence.   This  precedence scheme can be best shown
  364.             by some examples:
  365.  
  366.                  A & B + C = C + A & B = (A & B) + C
  367.                  A + B * C = (A + B) * C
  368.                  A * B + C = (A * B) + C
  369.                  ~A & B & ~C = ( (~A) & B) & (~C)
  370.                  ~(A + B) & ~C + D = ( ( ~(A + B) ) & (~C) ) + D
  371.  
  372.                  All nodes  in LOGSIM  are numbered.  Any integer from 0
  373.             to 1,000  can be  used.   In addition, there are two special
  374.             nodes: H  (a constant  logic high)  and L  (a constant logic
  375.             low), which can be used chip input nodes.  Example: JK h 2 3
  376.             4 5  6 7  is a JK flip flop with ~PRESET tied to logic high.
  377.             Using the  nodes H or L in a gate (ex.: AND 4 H 3) is WRONG!
  378.             and will cause errors!
  379.  
  380.                  There can  be up  to one  thousand nodes  in a  circuit
  381.             descriptor.
  382.  
  383.               2.2 Tri-State and Open Collector Outputs
  384.  
  385.  
  386.                  In LOGSIM, all outputs are capable of being wired-ANDed
  387.             together (like open-collector outputs).  If you connect sev-
  388.             eral outputs together, the state at that node will be a
  389.             logic high if and only if all the outputs on that node are
  390.  
  391.  
  392.  
  393.  
  394.                                        LOGSIM
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                                                         4
  401.  
  402.  
  403.             logic highs.  If any output to that node is a logic low, the
  404.             node will be a logic low.
  405.  
  406.                  Tri-state devices  are implemented by having the output
  407.             of the  device go  high in  the high-Z  state.  For example,
  408.             consider a  tri-state  inverter  with  the  following  truth
  409.             table:
  410.  
  411.                            A  B    C (Output)
  412.                            L  X    Z (high impedance)
  413.                            H  L    H
  414.                            H  H    L
  415.  
  416.                  In LOGSIM,  this can  be represented  by  the  equation
  417.             C = ~A +  B.   Note that in LOGSIM, and this manual, the "~"
  418.             is used to show negation, "~A" means "NOT A".
  419.  
  420.               2.3 Initial Conditions
  421.  
  422.  
  423.                  Before LOGSIM  starts simulating  your circuit, it must
  424.             determine the  initial state of your circuit.  To do this it
  425.             assumes that  all nodes  start at  high logic  states, holds
  426.             clocks and data sources in their initial states, and repeat-
  427.             edly calculates  new states  for your  circuit.  During this
  428.             process, all delays in the circuit are set to one time unit.
  429.  
  430.                  You are  responsible  for  ensuring  that  the  circuit
  431.             starts in  a known state!  The easiest way is to have a data
  432.             source that  initializes the  circuit elements as necessary,
  433.             and then  goes to an inactive state after one time unit.  If
  434.             the circuit  contains unstable  elements, LOGSIM will inform
  435.             you of  that fact with a message "Element driving node xx is
  436.             unstable."
  437.  
  438.                  The INITIAL  option (see below) can be used to manually
  439.             set the state of your circuit.  If this is done, LOGSIM uses
  440.             that as the initial state and does not use this process.
  441.  
  442.             3. Describing the Circuit
  443.  
  444.  
  445.                  The circuit  description consists of a number of lines,
  446.             each of  which is an element, followed by an END line.  Each
  447.             line is either a gate, chip, clock, or data source.
  448.  
  449.                  Very Important!  Use only spaces to separate items.  Do
  450.             not use commas, or any other punctuation.
  451.  
  452.               3.1 Gates
  453.  
  454.  
  455.                  LOGSIM has  some standard  gates--AND, NAND,  OR,  NOR,
  456.             XOR, XNOR, NOT, BUFFER, DELAYH, DELAYL, and DELAY--built in.
  457.  
  458.  
  459.  
  460.                                        LOGSIM
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                                                         5
  467.  
  468.  
  469.             All the  gates have  one output node, and the AND, NAND, OR,
  470.             NOR, XOR  and XNOR  can take  up to 32 input nodes.  The NOT
  471.             gate is  a simple inverter, the BUFFER gate is a non-invert-
  472.             ing buffer,  and the  DELAY gate  is a  non-inverting buffer
  473.             with a  constant, specified  delay.   The DELAYH  and DELAYL
  474.             gates are  similar to  the DELAY gate, except that they only
  475.             delay high  or low  logic states  (respectively) by the con-
  476.             stant delay.  The opposite state (low for a DELAYH, high for
  477.             a DELAYL)  is delayed  by only 1 time unit.  These gates are
  478.             further described  below, and the default gate delay (1 time
  479.             unit +  1 time unit per input driven) formula can be changed
  480.             by the GATEDELAY option described below.
  481.  
  482.                 3.1.1 AND Gate
  483.  
  484.  
  485.                  Syntax: AND [output] [input] [input] [input] ...
  486.  
  487.                  This gate ANDs together all the input nodes and outputs
  488.             that value  to the output node.  Up to 32 nodes can be ANDed
  489.             together with  one gate.  This gate has a default delay of 1
  490.             time unit + 1 time unit per input driven.
  491.  
  492.                  Example: AND  3 1 2 5 15 will generate a high at node 3
  493.             if all of nodes 1, 2, 5, and 15 are high.
  494.  
  495.                 3.1.2 BUFFER Gate
  496.  
  497.  
  498.                  Syntax: BUFFER [output] [input]
  499.  
  500.                  This gate  is a  non-inverting buffer--the value of the
  501.             input appears at the output. This gate only takes one input,
  502.             and has a default delay of 1 time unit + 1 time unit per in-
  503.             put driven.
  504.  
  505.                  Example: BUFFER 4 5.  Node 4 equals the value of node 5
  506.             (after the gate's inherent delay of course).
  507.  
  508.                 3.1.3 DELAY Gate
  509.  
  510.  
  511.                  Syntax: DELAY [output] [input] [delay]
  512.  
  513.                  This gate is a non-inverting buffer with a constant de-
  514.             lay.   Use this  to simulate any fixed delay in the circuit.
  515.             This gate  only takes one input.  The longest delay possible
  516.             in LOGSIM is 32,767 time units.
  517.  
  518.                  Example: DELAY  12 1  10.  The value of node 1 will ap-
  519.             pear at node 12 after a delay of 10 time units.
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.                                        LOGSIM
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                                                         6
  533.  
  534.  
  535.                 3.1.4 DELAYH Gate
  536.  
  537.  
  538.                  Syntax: DELAYH [output] [input] [delay]
  539.  
  540.                  This gate  is a non-inverting buffer which delays logic
  541.             high states by a constant delay.  The longest delay possible
  542.             in LOGSIM  is 32,767  time units.   This gate only takes one
  543.             input.  For example, if the input to a DELAYH gate (with a 4
  544.             time unit delay) is the pattern:
  545.                  000011111111100000001000000, the output will be
  546.                  000000001111110000000000000.
  547.  
  548.                  Example: DELAYH  12 1 10.  The value of node 1 will ap-
  549.             pear at  node 12  after a  delay of 10 time units if it is a
  550.             logic high, or 1 time unit if it is a logic low.
  551.  
  552.                 3.1.5 DELAYL Gate
  553.  
  554.  
  555.                  Syntax: DELAYL [output] [input] [delay]
  556.  
  557.                  This gate  is a non-inverting buffer which delays logic
  558.             low states  by a constant delay.  The longest delay possible
  559.             in LOGSIM  is 32,767  time units.   This gate only takes one
  560.             input.  For example, if the input to a DELAYL gate (with a 4
  561.             time unit delay) is the pattern:
  562.                  111100000000011111110111111, the output will be
  563.                  111111110000001111111111111.
  564.  
  565.                  Example: DELAYL  12 1 10.  The value of node 1 will ap-
  566.             pear at  node 12  after a  delay of 10 time units if it is a
  567.             logic low, or 1 time unit if it is a logic high.
  568.  
  569.                 3.1.6 NAND Gate
  570.  
  571.  
  572.                  Syntax: NAND [output] [input] [input] [input] ...
  573.  
  574.                  This gate  NANDs together  all the input nodes and out-
  575.             puts that  value to  the output node.  Up to 32 nodes can be
  576.             NANDed together  with one gate.  This gate has a default de-
  577.             lay of 1 time unit + 1 time unit per input driven.
  578.  
  579.                  Example: NAND  3 1 2 5 15 will generate a low at node 3
  580.             if all of nodes 1, 2, 5, and 15 are high.
  581.  
  582.                 3.1.7 NOR Gate
  583.  
  584.  
  585.                  Syntax: NOR [output] [input] [input] [input] ...
  586.  
  587.                  This gate NORs together all the input nodes and outputs
  588.             that value  to the output node.  Up to 32 nodes can be NORed
  589.  
  590.  
  591.  
  592.                                        LOGSIM
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                                                         7
  599.  
  600.  
  601.             together with  one gate.  This gate has a default delay of 1
  602.             time unit + 1 time unit per input driven.
  603.  
  604.                  Example: NOR  3 1  2 5 15 will generate a low at node 3
  605.             if any of nodes 1, 2, 5, or 15 is high.
  606.  
  607.                 3.1.8 NOT Gate
  608.  
  609.  
  610.                  Syntax: NOT [output] [input]
  611.  
  612.                  This gate is simple inverter--the value of the input is
  613.             inverted and appears at the output. This gate only takes one
  614.             input, and  has a default delay of 1 time unit + 1 time unit
  615.             per input driven.
  616.  
  617.                  Example: NOT  4 5.   Node  4 equals  the inverse of the
  618.             value of node 5 (after the gate's inherent delay of course).
  619.  
  620.                 3.1.9 OR Gate
  621.  
  622.  
  623.                  Syntax: OR [output] [input] [input] [input] ...
  624.  
  625.                  This gate  ORs together all the input nodes and outputs
  626.             that value  to the  output node.  Up to 32 nodes can be ORed
  627.             together with  one gate.  This gate has a default delay of 1
  628.             time unit + 1 time unit per input driven.
  629.  
  630.                  Example: OR  3 1  2 5 15 will generate a high at node 3
  631.             if any of nodes 1, 2, 5, or 15 is high.
  632.  
  633.                 3.1.10 XNOR Gate
  634.  
  635.  
  636.                  Syntax: XNOR [output] [input] [input] [input] ...
  637.  
  638.                  This gate  XNORs together  all the input nodes and out-
  639.             puts that  value to  the output node.  Up to 32 nodes can be
  640.             XNORed together  with one gate.  This gate has a default de-
  641.             lay of 1 time unit + 1 time unit per input driven.
  642.  
  643.                  Example: XNOR 3 1 2 5 15 will generate a high at node 3
  644.             if the  value of node 3 exclusive-or the value of node 2 ex-
  645.             clusive-or the  value of  node 5  exclusive-or the  value of
  646.             node 15 is a logic low.
  647.  
  648.                 3.1.11 XOR Gate
  649.  
  650.  
  651.                  Syntax: XOR [output] [input] [input] [input] ...
  652.  
  653.                  This gate XORs together all the input nodes and outputs
  654.             that value  to the output node.  Up to 32 nodes can be XORed
  655.  
  656.  
  657.  
  658.                                        LOGSIM
  659.  
  660.  
  661.  
  662.  
  663.  
  664.                                                                         8
  665.  
  666.  
  667.             together with  one gate.  This gate has a default delay of 1
  668.             time unit + 1 time unit per input driven.
  669.  
  670.                  Example: XOR  3 1 2 5 15 will generate a high at node 3
  671.             if the  value of node 3 exclusive-or the value of node 2 ex-
  672.             clusive-or the  value of  node 5  exclusive-or the  value of
  673.             node 15 is a logic high.
  674.  
  675.               3.2 Chips
  676.  
  677.  
  678.                  Syntax: [chip name] [pin assignments]
  679.  
  680.                  LOGSIM provides  a facility for adding new circuit ele-
  681.             ments--chip descriptors.   A  chip descriptor is a file that
  682.             describes the  function a  chip.   It can  also be used as a
  683.             macro facility  to simulate  large chunks  of circuitry.  If
  684.             LOGSIM does  not recognize an element as a gate, it searches
  685.             for a  file with  the same  name.   You can provide full DOS
  686.             paths as  your chip  name.   For example,  if your  chip  is
  687.             called "JK" in your circuit descriptor file, LOGSIM looks in
  688.             the current  directory of the current drive for a file named
  689.             JK.  If you called it "B:\logsim\chips\jk.dat", LOGSIM would
  690.             search for the file B:\LOGSIM\CHIPS\JK.DAT.
  691.  
  692.                  After the  name, the  pin assignments are listed.  This
  693.             is a  of what node each pin is tied to, starting with pin 1.
  694.             If you  had a  four pin chip named "4PIN" and pin 1 was tied
  695.             to node 4, pin 2 to node 3, pin 3 to a constant high and pin
  696.             4 to node 2, the line in the circuit descriptor would be:
  697.                                     4PIN 4 3 h 2
  698.  
  699.                  A chip can have up to sixty pins.
  700.  
  701.                  Several standard  chips are included in LOGSIM, all are
  702.             standard DIP packages.  They are described below:
  703.  
  704.                 3.2.1 D Chip Descriptor
  705.  
  706.  
  707.                  The D chip descriptor is identical to the 7476 chip de-
  708.             scriptor (see below).  It is included only for compatibility
  709.             with LOGSIM version 1.0.
  710.  
  711.                 3.2.2 JK Chip Descriptor
  712.  
  713.  
  714.                  The JK  chip descriptor  is identical to the 74112 chip
  715.             descriptor (see below).  It is included only for compatibil-
  716.             ity with LOGSIM version 1.0.
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.                                        LOGSIM
  725.  
  726.  
  727.  
  728.  
  729.  
  730.                                                                         9
  731.  
  732.  
  733.                 3.2.3 7476 Chip Descriptor
  734.  
  735.             The 7476 Chip Descriptor represents ½ of a 7476 chip, and is
  736.             a negative-edge triggered D flip flop with active-low preset
  737.             and clear.  The pin assignment is: (1) ~Preset; (2) D; (3)
  738.             Clock; (4) ~Clear; (5) Q; (6) ~Q
  739.  
  740.                                    Function Table
  741.                       Inputs             Outputs
  742.                       ~PRE  ~CLR  CLK D | Q ~Q
  743.                        L     L    X  X | H  H
  744.                         L     H    X  X | H  L
  745.                         H     L    X  X | L  H
  746.                         H     H    v  L | L  H
  747.                         H     H    v  H | H  L
  748.                         H     H    X  X | Q ~Q
  749.  
  750.                 3.2.4 74112 Chip Descriptor
  751.  
  752.  
  753.                  The 74112 Chip Descriptor is equivalent to ½ of a 74112
  754.             chip.   It represents a negative-edge-triggered JK flip-flop
  755.             with preset  and clear.   Both  preset and  clear are active
  756.             low.
  757.  
  758.                  Pin assignment:  (1) ~Preset;  (2) J; (3) Clock; (4) K;
  759.             (5) ~Clear; (6) Q; (7) ~Q
  760.  
  761.                            Function Table
  762.                  Inputs        Outputs
  763.                  ~PRE ~CLR CLK J K |  Q    ~Q
  764.                    L    L   X  X X |  H     H
  765.                    L    H   X  X X |  H     L
  766.                    H    L   X  X X |  L     H
  767.                    H    H   v  L L |  Q    ~Q       v indicates a
  768.                    H    H   v  L H |  L     H       falling edge
  769.                    H    H   v  H L |  H     L
  770.                    H    H   v  H H | ~Q     Q
  771.                    H    H   H  X X |  Q    ~Q
  772.  
  773.                 3.2.5 74123 Chip Descriptor
  774.  
  775.  
  776.                  The 74123 chip descriptor represents ½ of a 74123 chip.
  777.             Chip delays  are the  standard 1  + 1  time unit  per  input
  778.             driven.    Pins  1 and 2 are the A and B inputs of the chip,
  779.             pin 3  is clear,  and pins  4 and  5 are Q and ~Q.  A DELAYL
  780.             gate must  be connected  between pins  6 and 7 (pin 7 is the
  781.             output of  the DELAYL,  6 the  input to  the DELAYL).  Total
  782.             pulse duration  is equal to the delay of the DELAYL plus the
  783.             delay at  node 6  (driving one  output--the DELAYL) plus any
  784.             delay from the output of the DELAYL to the input of the one-
  785.             shot.   It is a 7-pin chip and is described by the following
  786.             table:
  787.  
  788.  
  789.  
  790.                                        LOGSIM
  791.  
  792.  
  793.  
  794.  
  795.  
  796.                                                                         10
  797.  
  798.  
  799.                       
  800.                       Input    Output
  801.                       1 2 3 7 | Q ~Q  6
  802.                       X X L X | L  H  L
  803.                       v H H X | H  L  H
  804.                       L ^ H X | H  L  H
  805.                       L H ^ X | H  L  H
  806.                       X X X v | 6 ~6  L
  807.                       X X X X | Q ~Q  L
  808.  
  809.                  Lines 2  through 4 of the table show the different ways
  810.             to trigger the one-shot.  In addition to the change of Q and
  811.             ~Q, a  low is outputted on pin 6.  The pulse continues until
  812.             the low in seen on pin 7 (delayed by the DELAYL, of course),
  813.             as shown by line 5.  The 6 and ~6 for Q and ~Q in line 5 are
  814.             to handle  the case  that the one-shot may have been retrig-
  815.             gered just  as pin  7 falls.  These equations force the one-
  816.             shot to trigger again.
  817.  
  818.                 3.2.6 74126 Chip Descriptor
  819.  
  820.  
  821.                  The 74126 chip descriptor represents ¼ of a 74126 chip.
  822.             This is  a three-state  buffer, where  pin 1 is the control,
  823.             pin 2  the input, and pin 3 the output.  Chip delays are the
  824.             standard 1  + 1  time unit  per input driven.  It can be de-
  825.             scribed as follows:
  826.                            
  827.                            Input | Output
  828.                              1 2 | 3
  829.                              L X | Z   (H in LOGSIM)
  830.                              H L | L
  831.                              H H | H
  832.  
  833.                 3.2.7 74192 Chip Descriptor
  834.  
  835.  
  836.                  The 74192  chip descriptor  represents a standard 74192
  837.             counter.   The pin  assignments are  exactly as  in the real
  838.             chip (including pin 8 for ground, and pin 16 for Vcc).  Pins
  839.             8 & 16 are don't cares--you can tie them to anything without
  840.             affecting the chip descriptor.
  841.  
  842.                 3.2.8 74193 Chip Descriptor
  843.  
  844.  
  845.                  The 74193  chip descriptor  represents a standard 74193
  846.             counter.   The pin  assignments are  exactly as  in the real
  847.             chip (including pin 8 for ground, and pin 16 for Vcc).  Pins
  848.             8 & 16 are don't cares--you can tie them to anything without
  849.             affecting the chip descriptor.
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.                                        LOGSIM
  857.  
  858.  
  859.  
  860.  
  861.  
  862.                                                                         11
  863.  
  864.  
  865.                 3.2.9 74253 Chip Descriptor
  866.  
  867.  
  868.                  The 74253  chip descriptor  represents ½  of a standard
  869.             74253 4-to-1  multiplexer.  It is an 8-pin chip and chip de-
  870.             lays are  the standard  1 +  1 time  unit per  input driven.
  871.             Pins 1  and 2  are the  select lines (pin 2 is most signifi-
  872.             cant), pin  3 is the active-low output control.  If pin 3 is
  873.             high, the  output is  forced high.  Pins 4 through 7 are the
  874.             inputs C0 through C3, and pin 8 is the output.  The function
  875.             can  be  described  by  the  equation:  8 = 3 + (4&~2&~1)  +
  876.             (5&~2&1) + (6&2&~1) + (7&2&1).
  877.  
  878.               3.3 Clocks
  879.  
  880.  
  881.                  Syntax: CLOCK [output] [pattern]
  882.  
  883.                  CLOCKS are inputs from the outside world.  They apply a
  884.             periodic pattern  to their  output pin.  The period is given
  885.             by the length of the pattern specified.  If you want node 21
  886.             driven by  a clock  with a 10 time unit period, of which the
  887.             first 3  are low and the last 7 are high, that would be rep-
  888.             resented by the line: CLOCK 21 0001111111.  Another example:
  889.             The line  CLOCK 1  1111001 represents a clock driving node 1
  890.             with a  period of  7, of  which the  first 4 and last 1 time
  891.             units are high and the 5th and 6th time units are low.
  892.  
  893.                  Long series  of 1's  and 0's  can be  compressed to the
  894.             forms "(repeat  * 1)"  and "(repeat * 0)" respectively.  For
  895.             example, the  line "CLOCK  21 0001111111"  can be  condensed
  896.             into "CLOCK 21 (3*0)(7*1)".  Note that only a single bit can
  897.             follow the  asterisk, trying to represent the pattern 010101
  898.             with (3*01) is wrong and WILL NOT WORK.
  899.  
  900.               3.4 Data Sources
  901.  
  902.  
  903.                  Syntax: DATA [output] [pattern]
  904.  
  905.                  DATA SOURCES  are inputs  from the outside world.  They
  906.             apply a  specified pattern  to their  output  pin.    Unlike
  907.             clocks, which  continuously repeat  their  pattern,  a  data
  908.             source remains  at its  last state when the pattern has been
  909.             exhausted.   For example,  the line  DATA 5  1001 is  a data
  910.             source driving  node 5  that starts  high, goes low for time
  911.             units 2 and 3, and then goes high for the rest of eternity.
  912.  
  913.                  Long series  of 1's  and 0's  can be  compressed to the
  914.             forms "(repeat  * 1)"  and "(repeat * 0)" respectively.  For
  915.             example, the line "DATA 21 0001111111" can be condensed into
  916.             "DATA 21 (3*0)(7*1)".   Note that only a single bit can fol-
  917.             low the  asterisk, trying  to represent  the pattern  010101
  918.             with (3*01) is wrong and WILL NOT WORK.
  919.  
  920.  
  921.  
  922.                                        LOGSIM
  923.  
  924.  
  925.  
  926.  
  927.  
  928.                                                                         12
  929.  
  930.  
  931.             4. Simulating the Circuit
  932.  
  933.  
  934.                  Now that you've described your circuit, LOGSIM can sim-
  935.             ulate it.   By default, LOGSIM uses a constant one time unit
  936.             delay for  every output  (regardless of inputs driven), dis-
  937.             plays on the CRT, and goes for 100 time units.  By selecting
  938.             options, you  can change  these defaults to better suit your
  939.             needs.
  940.  
  941.               4.1 Simulation Time
  942.  
  943.  
  944.                  Syntax: TIME [end]
  945.                       OR
  946.                          TIME [start] [end]
  947.  
  948.                  The circuit  simulation can  last for  any number up to
  949.             32,767 time  units.  The default is 100 time units (based on
  950.             a screen width of 100) but this can be changed with the TIME
  951.             option.   If you change the screen width (with the WIDTH op-
  952.             tion), the  default simulation  time will also change to the
  953.             screen width.   The  number [end]  specified is  the time in
  954.             time units  to simulate.  For example, TIME 120 will run the
  955.             simulation for 120 time units.
  956.  
  957.                  If you  choose the second form (TIME [start] [end]) the
  958.             output from  the simulation  will only  be produced  for the
  959.             times between start and end.  For example, TIME 100 200 will
  960.             simulate the circuit for 200 time units, and the only output
  961.             that will  appear will  be that  between 100  and  200  time
  962.             units.
  963.  
  964.               4.2 Rise Time Calculations
  965.  
  966.  
  967.                  Syntax: RISE [n]
  968.                       OR
  969.                          RISE VARIABLE
  970.                       OR
  971.                          RISE FIXED
  972.  
  973.                  Output delays  can be  calculated in one of three meth-
  974.             ods.     Delays  can  be  constant  throughout  the  circuit
  975.             (exception: DELAY,  DELAYL and  DELAYH gates), or delays can
  976.             be a constant delay plus a certain amount per input the out-
  977.             put drives.   The constant delay and the increment per input
  978.             depends on what type of element is under consideration.  The
  979.             third method  just uses  the constant, element-dependant de-
  980.             lay.  These three methods can be expressed as:
  981.  
  982.                  1) Delay = n
  983.  
  984.  
  985.  
  986.  
  987.  
  988.                                        LOGSIM
  989.  
  990.  
  991.  
  992.  
  993.  
  994.                                                                         13
  995.  
  996.  
  997.                  2) Delay = f(element type) + v(element type) * # inputs
  998.                             driven by the output
  999.  
  1000.                  or
  1001.  
  1002.                  3) Delay = f(element type)
  1003.  
  1004.                  By default,  LOGSIM uses the first form, with a uniform
  1005.             1 time  unit delay  for all  elements.   You can change this
  1006.             with the  RISE option.  The longest delay possible in LOGSIM
  1007.             is 32,767 time units.
  1008.  
  1009.                  To select  a uniform  delay for  all  elements  (except
  1010.             DELAY gates),  use the "RISE n" option.  For example, RISE 4
  1011.             will set  the output  delay for  all elements  except  DELAY
  1012.             gates to 4 time units.  This option overrides all delay for-
  1013.             mulas, including those specified with the GATEDELAY option.
  1014.  
  1015.                  To select  the fixed + increment delay (#2, above), use
  1016.             the RISE  VARIABLE option.   If  you are using the GATEDELAY
  1017.             option, either  RISE VARIABLE or RISE FIXED is also required
  1018.             before those numbers are utilized.
  1019.  
  1020.                  To select  fixed  delay  based  on  element  type  (#3,
  1021.             above), use the RISE FIXED option.
  1022.  
  1023.               4.3 Gate Delays
  1024.  
  1025.  
  1026.                  Syntax: GATEDELAY [fixed] [variable]
  1027.  
  1028.                  By default,  all gates in LOGSIM use a delay formula of
  1029.             1 time  unit +  1 time unit per input driven.  The GATEDELAY
  1030.             option is  used to  change the  numbers to  whatever is  re-
  1031.             quired. The  formula is always [fixed] + [variable] * number
  1032.             of inputs driven.  Example: GATEDELAY 2 0.1 changes the gate
  1033.             delays to 2 time units + 0.1 time units per input driven.
  1034.  
  1035.                  Note that  unless you  use either  the RISE VARIABLE or
  1036.             RISE FIXED option, GATEDELAY does not have any effect.
  1037.  
  1038.               4.4 Initial Conditions
  1039.  
  1040.  
  1041.                  Syntax:   INITIAL   [1st   node's   value][2nd   node's
  1042.                       value]...[last node's value]
  1043.  
  1044.                  This option  allows you to specify the initial state of
  1045.             all the  nodes in  the circuit  (note: it  must be  ALL, not
  1046.             some).   Simply list  the logic states (1 or 0) of each node
  1047.             in ascending  order after  the word  INITIAL.   For example,
  1048.             INITIAL 00001111  is an  8 node  circuit,  where  the  first
  1049.             (lowest numbered) 4 start low and the last 4 high.
  1050.  
  1051.  
  1052.  
  1053.  
  1054.                                        LOGSIM
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060.                                                                         14
  1061.  
  1062.  
  1063.               4.5 Output Modes
  1064.  
  1065.  
  1066.                  LOGSIM can  output the results of its simulation in one
  1067.             of four ways: it can display on the CRT (the default), write
  1068.             to a file, print using graphics, or a quick-and-dirty print-
  1069.             out.  By using the DISPLAY, FILE, PRINT, and FPRINT options,
  1070.             the user  can select  which of these four methods.  Only one
  1071.             method can be used in any given simulation, so including two
  1072.             or more  of these option in your circuit descriptor file re-
  1073.             sults in only the last one taking effect.
  1074.  
  1075.                  To see  samples of  all four  output modes, execute the
  1076.             batch file OUTSAMPL.BAT.
  1077.  
  1078.                 4.5.1 Display
  1079.  
  1080.  
  1081.                  Syntax: DISPLAY
  1082.  
  1083.                  LOGSIM will  display the  timing diagram resulting from
  1084.             the simulation  on the  CRT.  If nodes are selected with the
  1085.             MONITOR option,  they will  be displayed,  otherwise the  20
  1086.             lowest numbered nodes will be shown.
  1087.  
  1088.                  LOGSIM can  fit 600 time units (default is only 100) on
  1089.             the screen,  and will  beep when the screen is full.  LOGSIM
  1090.             will then  wait until the user presses a key before display-
  1091.             ing the next screenfull.
  1092.  
  1093.                 4.5.2 File
  1094.  
  1095.  
  1096.                  Syntax: FILE [filename]
  1097.  
  1098.                  LOGSIM will  output the circuit timing to the specified
  1099.             file.  Every node in the circuit will be listed, even if the
  1100.             MONITOR option has been used.
  1101.  
  1102.                  A sample  of FILE  output, using  the circuit  0124, is
  1103.             shown below.
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                                        LOGSIM
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126.                                                                         15
  1127.  
  1128.  
  1129.                       
  1130.                       
  1131.                                           Timing List
  1132.                       
  1133.                                       Nodes
  1134.                             000000000
  1135.                             000000000
  1136.                             000001111
  1137.                       Time  123453456
  1138.                       
  1139.                       1     001110001
  1140.                       2     011110001
  1141.                       3     011110001
  1142.                       4     011110001
  1143.                       5     111110001
  1144.                       6     111110001
  1145.                       7     111110001
  1146.                       8     011110001
  1147.                       9     011110000
  1148.                       10    011110010
  1149.                       11    011110010
  1150.                       12    111110010
  1151.                       13    111110010
  1152.                       14    111110010
  1153.                       15    011110010
  1154.                       16    011110011
  1155.                       17    011010101
  1156.                       18    011010101
  1157.                       19    111000101
  1158.                       20    111000101
  1159.                       21    111000101
  1160.                       22    011000101
  1161.                       23    011001101
  1162.                       24    010101001
  1163.                       25    010101001
  1164.  
  1165.                  The left-most  column is the time in time units.  Read-
  1166.             ing down  each column,  the top  is the node number (a four-
  1167.             digit number,  i.e. the  first node listed is 0001, the next
  1168.             0002, and  so on up to node 0016).  Below that, reading ver-
  1169.             tically in  each column,  is a  list of  the states for that
  1170.             node.   A '1'  indicates a logic high, and a '0' indicates a
  1171.             logic low.
  1172.  
  1173.                 4.5.3 Print
  1174.  
  1175.  
  1176.                  Syntax: PRINT
  1177.  
  1178.                  Use of this option requires that you had previously run
  1179.             the graphics  screen dump  program (GRAPHICS.COM  on PC-DOS,
  1180.             PSC.....COM on MS-DOS, see your DOS manual for more informa-
  1181.             tion).  The PRINT option is identical to the DISPLAY option,
  1182.             but at  the end of each screenfull, instead of the beep-and-
  1183.  
  1184.  
  1185.  
  1186.                                        LOGSIM
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.                                                                         16
  1193.  
  1194.  
  1195.             wait routine, LOGSIM copies the screen to the printer.  This
  1196.             takes time.
  1197.  
  1198.                 4.5.4 Fprint
  1199.  
  1200.  
  1201.                  FPRINT (which  stands for  Fast PRINT)  will print  the
  1202.             timing diagram  on the  printer in  the LPT1:  slot  (a.k.a.
  1203.             prn).   It is much faster than the PRINT option, but doesn't
  1204.             look as  nice.   FPRINT displays the nodes selected with the
  1205.             MONITOR option,  or the  twenty lowest numbered nodes if the
  1206.             MONITOR option is not used.
  1207.  
  1208.                  A sample  of FPRINT, from the 0124 sample circuit, look
  1209.             like:
  1210.                                                Timing List
  1211.                       
  1212.                                         Nodes
  1213.                        0   0    0    0
  1214.                        0   0    0    0
  1215.                        0   1    1    1
  1216.                        1   3    4    5
  1217.                       |   |    |    |
  1218.                       |   |    |    |
  1219.                       |   |    |    |
  1220.                       |   |    |    |
  1221.                        \  |    |    |
  1222.                         | |    |    |
  1223.                         | |    |    |
  1224.                        /  |    |    |
  1225.                       |   |    |    |
  1226.                       |   |    |     \
  1227.                       |   |    |      |
  1228.                        \  |    |      |
  1229.                         | |    |      |
  1230.                         | |    |      |
  1231.                        /  |    |      |
  1232.                       |   |    |      |
  1233.                       |   |     \    /
  1234.                       |   |      |  |
  1235.                        \  |      |  |
  1236.                         | |      |  |
  1237.                         | |      |  |
  1238.                        /  |      |  |
  1239.                       |    \     |  |
  1240.                       |     |   /   |
  1241.                       |     |  |    |
  1242.  
  1243.                  Again, read the node numbers vertically in each column.
  1244.             The timing  diagram makes  more sense if you rotate the page
  1245.             90 degrees  counter-clockwise.   Now, read  it like a normal
  1246.             timing diagram,  with time  increasing to  the right.  A '\'
  1247.             indicates a rising edge, and a '/' indicates a falling edge.
  1248.  
  1249.  
  1250.  
  1251.  
  1252.                                        LOGSIM
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258.                                                                         17
  1259.  
  1260.  
  1261.               4.6 Time Units per Screen
  1262.  
  1263.  
  1264.                  Syntax: WIDTH [n]
  1265.  
  1266.                  By default,  LOGSIM displays  100 time units per screen
  1267.             (or page)  in the  DISPLAY and  PRINT output modes.  You can
  1268.             alter this  to anywhere  between 10  and 600  time units per
  1269.             screen with  the WIDTH  option.   Example: WIDTH 300 display
  1270.             300 time  units per screen (300 per page in PRINT mode).  If
  1271.             the TIME  option is  not used,  and the WIDTH option is, the
  1272.             simulation time will default to the screen width.
  1273.  
  1274.               4.7 Monitoring nodes
  1275.  
  1276.  
  1277.                  Syntax: MONITOR [node] [node] [node] ...
  1278.  
  1279.                  MONITOR is  used in conjunction with the DISPLAY, PRINT
  1280.             and FPRINT  options to select which nodes to display.  Up to
  1281.             twenty nodes  can be  selected in  any one  simulation.  The
  1282.             nodes will  be displayed  in the order that you list them in
  1283.             the MONITOR option, and you can repeat nodes if you wish.
  1284.  
  1285.                  Example: to display nodes 1, 3, 13, 14, 15, and 20, use
  1286.             MONITOR 1 3 13 14 15 20.
  1287.  
  1288.               4.8 Fanout Lists
  1289.  
  1290.  
  1291.                  Syntax: FANOUT
  1292.                       OR
  1293.                          FANOUT [file]
  1294.  
  1295.                  LOGSIM can count the number of inputs that each node is
  1296.             driving.   The FANOUT option will have LOGSIM display a list
  1297.             of how  many inputs  each node  is driving.  By default, the
  1298.             FANOUT list  appears on  the CRT,  but using the second form
  1299.             (FANOUT [file]) lets  you send  the output to a file of your
  1300.             choice.   For example, FANOUT CKT3FAN writes the fanout list
  1301.             to the file CKT3FAN.
  1302.  
  1303.             5. Chip Descriptions
  1304.  
  1305.  
  1306.                  The hardest  and most  useful (isn't  that  always  the
  1307.             case) part  of LOGSIM  lies in  its expandability.  Only the
  1308.             gates described  above are  built in  to the LOGSIM program.
  1309.             All other chips are included in chip descriptor files.  Yes,
  1310.             you can write you own chip descriptors, and now I'm going to
  1311.             tell you how.
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.                                        LOGSIM
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324.                                                                         18
  1325.  
  1326.  
  1327.               5.1 Making New Chips
  1328.  
  1329.  
  1330.                  To implement  a new  chip (or  macro), you must write a
  1331.             new chip  descriptor.   A chip  descriptor consists  of 4 or
  1332.             more lines  that functionally  describe the chip.  The first
  1333.             three lines  of a  chip descriptor state the number of pins,
  1334.             fixed and variable delay, the mode select pins, and the out-
  1335.             put pins.   The  remaining lines  contain equations  for the
  1336.             output pins conditions for the mode pins and  in that mode.
  1337.  
  1338.                 5.1.1 Pins, Delay, Mode and Output Pins
  1339.  
  1340.  
  1341.                  The first  line contains  three numbers:  the number of
  1342.             pins on  this chip,  the fixed delay increment and the delay
  1343.             increment.   Pins on a chip are numbered sequentially start-
  1344.             ing with 1.
  1345.  
  1346.                  The fixed  delay [  f(element) ]  and  delay  increment
  1347.             [ v(element) ] are used in computing rise times for the out-
  1348.             puts.  See the section on Rise Time Calculations.
  1349.  
  1350.                  The fixed  delay must  be an  integral number  of  time
  1351.             units, but  the variable  delay can can be in fractions of a
  1352.             time unit (e.g. 0.25)
  1353.  
  1354.                  The second line,  lists the Mode Select Pins.  Mode se-
  1355.             lect pins  are used to distinguish between several different
  1356.             behaviors of the chip.  For example, in the JK chip descrip-
  1357.             tor, pins  1, 3,  and 5  are mode  select pins--the ~PRESET,
  1358.             CLOCK, and  ~CLEAR  pins.  A JK flip flop's behavior is dif-
  1359.             ferent depending  on the  states of  the CLEAR,  PRESET, and
  1360.             CLOCK lines.
  1361.  
  1362.                  Mode select  pins are  included for convenience, as the
  1363.             JK chip descriptor could be re-written to use only the CLOCK
  1364.             pin as a mode select pin
  1365.  
  1366.                  Mode select  pins MUST  be used  for any edge-triggered
  1367.             inputs.
  1368.  
  1369.                  Every chip  descriptor MUST  have at least one mode se-
  1370.             lect pin!
  1371.  
  1372.                  The third line lists the output pins for this chip.  An
  1373.             output pin  is a pin whose state is determined by this chip.
  1374.             The output  delay associated with a chip applies between the
  1375.             output pin  and the  outside world.  For use within the same
  1376.             chip, there  is only a one time unit delay.  For example, in
  1377.             the JK  chip descriptor,  if the mode select pins fall under
  1378.             the HXH  state and  there is a 5 time unit delay.  The newly
  1379.             determined state for pins 6 and 7 appear 5 time units later,
  1380.             but they are usable in the chip itself one time unit later.
  1381.  
  1382.  
  1383.  
  1384.                                        LOGSIM
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390.                                                                         19
  1391.  
  1392.  
  1393.                 5.1.2 Chip Modes
  1394.  
  1395.  
  1396.                  Chip modes can be thought of as behavior patterns.  For
  1397.             example, a  74193 counter  can either be holding the present
  1398.             count, loading  a new  count with  the LOAD pin, clearing to
  1399.             zero with  the CLEAR pin, counting up, or counting down.  By
  1400.             implementing each  of those cases as patterns of mode select
  1401.             pins, the  equations are  simpler and more intuitively obvi-
  1402.             ous.
  1403.  
  1404.                  In order  to implement edge-triggered devices (example:
  1405.             the JK  flip flop,  on which  the clock pin is negative-edge
  1406.             triggered), you will have to include the edge-triggered pins
  1407.             among your mode select pins.
  1408.  
  1409.                 5.1.3 Output Equations
  1410.  
  1411.  
  1412.                  The fourth and following lines of a chip descriptor de-
  1413.             scribe contain  equations describing  the  chip's  function.
  1414.             Each line  consists of  a mode  select pattern, a colon (:),
  1415.             the equations  for the  output pins in that mode.  The equa-
  1416.             tions follow  the colon  and are  separated by  commas.  THe
  1417.             equations determine the states of the output pins--the first
  1418.             equation goes with the first output pin, the second with the
  1419.             second, etc.
  1420.  
  1421.                  The mode  select pattern  is a description of the state
  1422.             of the  mode select pins.  To represent this, LOGSIM uses an
  1423.             H to  represent a  logic high  state, an  L for low, a X for
  1424.             don't-care, a  v for  a falling  edge, and  a ^ for a rising
  1425.             edge.   In the  JK chip descriptor, the mode select pins are
  1426.             1, 3,  and 5.  The mode select pattern "HVH" means that node
  1427.             1 is  high, there is a falling edge on node 3, and node 5 is
  1428.             high.
  1429.  
  1430.                  LOGSIM examines  each mode  select pattern in the order
  1431.             they are  listed.   The equations  associated with the first
  1432.             one mode select pattern that applies are used.
  1433.  
  1434.                  Examples:  Using the JK chip descriptor (see below), if
  1435.             the current  states of  pins 1, 3, and 5 are high, low, low,
  1436.             then the  equations on the sixth line (with the HXL pattern)
  1437.             are used: pin 6 goes low and pin 7 goes high.
  1438.  
  1439.                  If nodes  1 and 5 remain high while node 3 changes from
  1440.             a high  to low state, the seventh line (HvH) applies.  These
  1441.             equations calculate  the new  state for the Q and ~Q outputs
  1442.             according to the standard JK truth table.
  1443.  
  1444.  
  1445.  
  1446.  
  1447.  
  1448.  
  1449.  
  1450.                                        LOGSIM
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456.                                                                         20
  1457.  
  1458.  
  1459.               5.2 Sample Chip Descriptions
  1460.  
  1461.                                The JK Chip Descriptor
  1462.  
  1463.                  This is a small chip descriptor that illustrates all of
  1464.             the design  topics discussed above.  Examining this chip de-
  1465.             scriptor should dispel any questions about the chip descrip-
  1466.             tor format.  The chip descriptor file is:
  1467.                       7 1 1
  1468.                       1 3 5
  1469.                       6 7
  1470.                       LxL: H, H
  1471.                       LxH: H, L
  1472.                       HxL: L, H
  1473.                       HvH: (6 & ~4) + (7 & 2), ~( (6 & ~4) + (7 & 2) )
  1474.                       HxH: ~7, ~6
  1475.  
  1476.                  It is a seven pin chip, with a delay of 1 time unit + 1
  1477.             per input  driven (7 1 1).  Pins 1, 3 and 5 are the mode se-
  1478.             lect pins (1 3 5), and pins 6 and 7 are the outputs (6 7).
  1479.  
  1480.                  The equations  show that  both outputs  (Q and  ~Q) are
  1481.             high when  pins 1  and 3 (~PRESET and ~CLEAR) are low.  Else
  1482.             if pin  1 is  low and  pin 5  is high (presetting), pin 6 is
  1483.             high and  pin 7  is low.  Else if pin 1 is high and pin 5 is
  1484.             low (clearing),  pin 6  is low and 7 is high. Else if pins 1
  1485.             and 5  are high while there is a falling edge on pin 3, pins
  1486.             6 and  7 follow  the standard  JK rules  (check them--you'll
  1487.             see).   Finally, if  pins 1 and 5 are high, pins 6 and 7 are
  1488.             inverses of each other ( Q = ~ (~Q) and ~Q = ~(Q) ).
  1489.  
  1490.               5.3 Simulating ROMS
  1491.  
  1492.  
  1493.                  ROMs are  easy to simulate.  Just use the address lines
  1494.             as the  mode select  lines and  express the output directly.
  1495.             For example,  an imaginary  4-word, 4-bit  ROM with contents
  1496.             0001, 0010,  0100, and  1111 in addresses 0, 1, 2, and 3 re-
  1497.             spectively.   Pins 1  through 2  are the address inputs, and
  1498.             pins 3  through 6  are the  data outputs,  delays are 4 time
  1499.             units plus  .25 time  units per  input driven.  This can  be
  1500.             coded as:
  1501.  
  1502.                       6 4 .25
  1503.                       1 2 3 4
  1504.                       5 6 7 8
  1505.                       LL:L,L,L,H
  1506.                       LH:L,L,H,L
  1507.                       HL:L,H,L,L
  1508.                       HH:H,H,H,H
  1509.  
  1510.                  Of course,  if you  can reduce the number of equations,
  1511.             you will only improve LOGSIM's performance.
  1512.  
  1513.  
  1514.  
  1515.  
  1516.                                        LOGSIM
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522.                                                                         21
  1523.  
  1524.  
  1525.               5.4 Simulating RAMS
  1526.  
  1527.  
  1528.                  Good Luck!   RAMs  have to be represented as a group of
  1529.             flip-flops with  address decoding  and output  selection--in
  1530.             other words, you'll have to build every memory cell by hand.
  1531.             This is one item that will be changed in the future.
  1532.  
  1533.               5.5 Simulating PALs and PLAs
  1534.  
  1535.  
  1536.                  This is  easier than  a ROM,  just write  the equations
  1537.             down and  you're done.   For  example,  consider  a  4-input
  1538.             (called A,  B, C,  and D),  4-output (called W, X, Y, and Z)
  1539.             PAL       which        implements       the       equations:
  1540.             W = A+B; X = W*~D; Y = A&B&C&D; Z = ~(A*B) + ~(C&D).   We'll
  1541.             use pins  1 through  4 for  A through D and pins 5 through 8
  1542.             for pins W through Z.  Since there is no obvious mode select
  1543.             pin, we'll choose pin 1.  Use a standard 1 time unit + 1 per
  1544.             input driven delay, and we get:
  1545.  
  1546.                       8 1 1
  1547.                       1
  1548.                       5 6 7 8
  1549.                       X: 1+2, 5*~4, 1&2&3&4, ~(1&2) + ~(3&4)
  1550.  
  1551.                  By using pin 1 as a mode select and using the pattern X
  1552.             (don't-care), we  meet LOGSIM's requirement for at least one
  1553.             mode select pin and we don't obscure the equations.
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.                                        LOGSIM
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.                                                                         A
  1589.  
  1590.  
  1591.                                        Index
  1592.             
  1593.             Chip descriptor, 8, 17
  1594.             Circuit descriptor, 2
  1595.             
  1596.             END statement, 2
  1597.             
  1598.             GRAPHICS.COM, 1
  1599.             
  1600.             Macro facility
  1601.               see Chip descriptor
  1602.             
  1603.             Output delays, 12
  1604.             
  1605.             Pin assignments, 8
  1606.             Precedence, 3
  1607.             PSCxxxx.COM, 1
  1608.             
  1609.             Special nodes, 3
  1610.             
  1611.             Time unit, 1
  1612.             
  1613.             Wired-ANDed, 3
  1614.             
  1615.  
  1616.  
  1617.  
  1618.  
  1619.  
  1620.  
  1621.  
  1622.  
  1623.  
  1624.  
  1625.  
  1626.  
  1627.  
  1628.  
  1629.  
  1630.  
  1631.  
  1632.  
  1633.  
  1634.  
  1635.  
  1636.  
  1637.  
  1638.  
  1639.  
  1640.  
  1641.  
  1642.  
  1643.  
  1644.  
  1645.  
  1646.  
  1647.  
  1648.                                        LOGSIM
  1649.  
  1650.  
  1651.